<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* img{
        width: 20px;
        height: 20px;
        vertical-align: bottom;
     } */
        .p {
            display: inline-block;
            background: url(/pink/imgs/正确.png) no-repeat left center;
            background-size: 19px 19px;
            color: silver;
            /* background-position: -800px -40px; */
            margin-left:20px ;
            padding: 0 0 0 20px;
            /* line-height: 21px; */
            /* vertical-align: bottom; */
        }
        .new{
            color: red;
            background: url(/pink/imgs/错误.png) no-repeat left center;
            background-size: 19px 19px;
        }
        .newz{
            color:chartreuse;
            background: url(/pink/imgs/正确.png) no-repeat left center;
            background-size: 19px 19px;
        }
    </style>
</head>

<body>
    <div>
        <input type="text">
        <p class="p">你输入的正确....</p>
    </div>
    <script>
        var ins = document.querySelector('input')
        var p = document.querySelector('.p')
        ins.onblur =function(){
            if(this.value.length<6 || this.value.length>16){
                p.className='p new'
                p.innerHTML='输入6-16位密码'
            }else{
                p.className='p newz'
                p.innerHTML='输入正确'
            }
           
        }
    </script>
</body>

</html>